using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Windows.Forms;

namespace p301.Reports.UrKons
{
    public partial class PrintUrKonsurKonsKpo : DevExpress.XtraReports.UI.XtraReport
    {
        int _iNPP = 1;
        int countRowSumm = 0;

        public PrintUrKonsurKonsKpo()
        {
            InitializeComponent();
        }

        public void InitSubReport(dsUrKons.dtAnalizUr_DataTable tableAnalizUr_)
        {
            BindingSource bs = new BindingSource();
            bs.DataSource = tableAnalizUr_.DataSet;
            bs.DataMember = tableAnalizUr_.TableName;
            bs.Filter = "K_RAZDEL = 2";
            this.DataSource = bs;
        }

        private void _NPP_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _NPP.Text = _iNPP.ToString();
            _iNPP++;
        }

        private void _rowSumm_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int rowSumm = 0;

            if(_konsTel.Text != "")
                rowSumm += int.Parse(_konsTel.Text);
   
            if(_konsNet.Text != "")
                rowSumm += int.Parse(_konsNet.Text);
 
            if(_konsPism.Text != "") 
                rowSumm += int.Parse(_konsPism.Text);

            _rowSumm.Text = rowSumm.ToString();

            countRowSumm += rowSumm;
        }

        private void _countRowSumm_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _countRowSumm.Text = countRowSumm.ToString();
        }

    }
}
